/**
 * 合同借阅列表
 * @author linfeng
 * @since 2019/12/24
 */
layui.extend({
    zmnExportUtil: '{/}/static/js/zmn.excel.util'
}).define(['index', 'form', 'table', 'laypage', 'layedit', 'zmnExportUtil'], function (exports) {
    var $ = layui.$;
    var form = layui.form;
    var layer = layui.layer;
    var table = layui.table;
    var laypage = layui.laypage;
    var layedit = layui.layedit;
    var zmnExportUtil =layui.zmnExportUtil;

    form.render();

    table.init('zmn-table', {
        toolbar: "#zmn-table-tool",
        page: false,
        defaultToolbar: ['exports'],
        limit: json.items.length,
        done: function () {
            $("div[lay-event='LAYTABLE_EXPORT']").attr('lay-event', 'CUSTOM_EXPORT');
        },
    });

    // 启用/停用
    table.on("toolbar(zmn-table)", function (obj) {
        //导出excel
        if(obj.event=='CUSTOM_EXPORT'){
            zmnExportUtil.doExportExcel('zmn-table','收付记录');
        }

    });

    //对外暴露的接口
    exports('contract_payment_record_list_js', {});
});

/**
 * 描述: 打开新增/修改合同收付记录页面
 **/
function modifyContractPaymentRecord(contractId, relateId){
    if (relateId == null || relateId == 0) {
        zmnLayUtil.openIframeCustom(layer, "/contract/payment/record/detail.action?contractId="+contractId+"&relateId="+relateId, {title: "新增收付记录", shade: 0.8, area:["550px", "510px"]});
    } else {
        zmnLayUtil.openIframeCustom(layer, "/contract/payment/record/detail.action?contractId="+contractId+"&relateId="+relateId, {title: "修改收付记录", shade: 0.8, area:["550px", "510px"]});
    }
}

